package com.shycloud.mido.music.mapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shycloud.mido.music.domain.MisMusic;
import com.shycloud.mido.music.vo.CoursewareDetailVO;
import com.shycloud.mido.music.vo.MisMusicVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface MisMusicMapper extends BaseMapper<MisMusic> {

	/**
	 * 分页获取曲目信息
	 *
	 * @param page
	 * @param conllectionId
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.shycloud.mido.music.vo.MisMusicVO>
	 * @author nianhua.jiang
	 * @date 2020/6/12 16:18
	 */
	IPage<MisMusicVO> getMusicPage(@Param("page") Page page, @Param("conllectionId") Integer conllectionId, @Param("memberId") String memberId);

	/**
	 * 判断该用户是否是vip用户
	 *
	 * @param memberId
	 * @return java.lang.String
	 * @author nianhua.jiang
	 * @date 2020/6/30 10:05
	 */
	String checkIsVip(@Param("memberId") String memberId);

	IPage<MisMusic> getMusicList(@Param("page") Page page, @Param("name") String name, @Param("status") String status, @Param("memberAuthority") String memberAuthority, @Param("id") Integer id, @Param("collectionId") Integer collectionId);

	IPage<MisMusic> getMusicDeleteList(@Param("page") Page page, @Param("name") String name, @Param("status") String status, @Param("memberAuthority") String memberAuthority, @Param("id") Integer id, @Param("collectionId") Integer collectionId);

	/**
	 * 获取书籍配套资源数量
	 *
	 * @param
	 * @return java.lang.Integer
	 * @author nianhua.jiang
	 * @date 2020/7/3 14:58
	 */
	List<MisMusic> getResouresCount();

	int updateDownLoadMp3Count();

	MisMusic getValidMusicById(@Param("musicId") Integer musicId);

	String getIsTeacher(@Param("memberId") String memberId);

	Map<String, Object> getMemberById(@Param("memberId") String memberId);

	@SqlParser(filter = true)
	IPage<CoursewareDetailVO> getMusicPageForCourseWare(@Param("page") Page page,
														@Param("collId") Integer collId,
														@Param("teacherId") String teacherId,
														@Param("studentId") String studentId);

	int clearKalaFile(@Param("id") Integer id);
}